<!DOCTYPE html>
<!--
Copyright 2013 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
  <head>
    <title></title>
    <meta charset="UTF-8">
    <script src="../../tools/test/htmltest.js"></script>
    <script src="../../node_modules/chai/chai.js"></script>
    <script src="../../platform.js" debug></script>
  </head>
  <body>
    <x-foo>plain</x-foo>
    <button is="x-baz">plain</button>
    <script>
      var assert = chai.assert;
      window.addEventListener('WebComponentsReady', function() {
        var p = Object.create(HTMLElement.prototype);
        p.readyCallback = function() {
          this.textContent = 'custom!';
        }
        document.register('x-foo', {prototype: p});
        //
        var p = Object.create(HTMLButtonElement.prototype);
        p.readyCallback = function() {
          this.textContent = 'custom!';
        }
        document.register('x-baz', {prototype: p, extends: 'button'});
        document.body.appendChild(document.createElement('x-baz')).id = 'baz2';
        //
        assert.equal(document.querySelector('x-foo').textContent, 'custom!',
          'x-foo must have custom text');
        //
        assert.equal(document.querySelector('[is=x-baz]').textContent,
          'custom!', 'button is="x-baz" must have custom text');
        assert.equal(document.querySelector('#baz2').textContent, 'custom!',
          'x-baz must have custom text');
        //
        done();
      });
    </script>
  </body>
</html>
